package com.snail.controller;

import com.snail.model.entity.Product;
import com.snail.model.entity.User;
import com.snail.model.pojo.SearchHitResult;
import com.snail.service.BizUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

/**
 * @author cici
 * @description 搜索用户
 * @date 2025/8/19 17:36
 */
@RequestMapping("/searchUser")
@RestController
public class BizUserController {
    @Autowired
    private BizUserService bizUserService;
    @GetMapping("/user")
    public ResponseEntity<?> searchUserByES(@RequestParam String keyword, @RequestParam int page, @RequestParam int size) {
        SearchHitResult<User> response = bizUserService.SearchAsHot(keyword,page,size);
        SearchHitResult<User> resp = bizUserService.searchAndSerialize(keyword,page,size);
        return ResponseEntity.ok(resp);
    }
}
